package com.defangit.award.domain;

import org.apache.commons.lang3.StringUtils;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by zhangfagen on 2018/12/30.
 */
public class Award {
    private int id;
    private String awardName;
    private String awardRule;
    private LocalDateTime beginTime;
    private LocalDateTime endTime;
    private List<Prize> prizes;
    private AwardType type;
    private String banner;
    private List<String> pics=new ArrayList<>();
    private int orgId;
    private LocalDateTime createTime=LocalDateTime.now();
    private AwardStatus status;

    public int getId() {
        return id;
    }

    public Award setId(int id) {
        this.id = id;
        return this;
    }

    public String getAwardName() {
        return awardName;
    }

    public Award setAwardName(String awardName) {
        this.awardName = awardName;
        return this;
    }

    public LocalDateTime getBeginTime() {
        return beginTime;
    }

    public Award setBeginTime(LocalDateTime beginTime) {
        this.beginTime = beginTime;
        return this;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public Award setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    public List<Prize> getPrizes() {
        return prizes;
    }

    public Award setPrizes(List<Prize> prizes) {
        this.prizes = prizes;
        return this;
    }

    public String getAwardRule() {
        return awardRule;
    }

    public Award setAwardRule(String awardRule) {
        this.awardRule = awardRule;
        return this;
    }

    public AwardType getType() {
        return type;
    }

    public Award setType(AwardType type) {
        this.type = type;
        return this;
    }

    public List<String> getPics() {
        return pics;
    }

    public Award setPics(List<String> pics) {
        this.pics = pics;
        return this;
    }

    public int getOrgId() {
        return orgId;
    }

    public Award setOrgId(int orgId) {
        this.orgId = orgId;
        return this;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public Award setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
        return this;
    }

    public String toString(){

        return this.awardName + System.lineSeparator() +"回复CJ开始抽奖"+System.lineSeparator()
            + StringUtils.join(prizes.parallelStream().map(Prize::getPrizeName).collect(Collectors.toList()), System.lineSeparator());
    }

    public enum AwardStatus{
        CLOSED
    }
}
